package com.example.scaffold_demo.widget.eventbus;


import org.greenrobot.eventbus.EventBus;

/**
 * Created by XiaoJianjun on 2017/5/11.
 * 将EventBus封装一层.
 */
public class EventBusUtil {

    public static void register(Object subscriber) {
        if(!EventBus.getDefault().isRegistered(subscriber)) {//加上判断
            EventBus.getDefault().register(subscriber);
        }
    }

    public static void unregister(Object subscriber) {
        if (EventBus.getDefault().isRegistered(subscriber))//加上判断
            EventBus.getDefault().unregister(subscriber);
    }

    public static void sendEvent(EventBean event) {
        EventBus.getDefault().post(event);
    }

    public static void sendStickyEvent(EventBean event) {
        EventBus.getDefault().postSticky(event);
    }


    // 其他
}
